package pkmn.move;

import pkmn.battle.BattlePokemon;
import pkmn.status.BattleStatusEnum;
import pkmn.util.Util;

public class ApplyProtect extends IndirectAction {

    @Override
    public void execute(BattlePokemon battlePokemon) {
        int accuracy = 100;
        if (battlePokemon.haveBattleStatus(BattleStatusEnum.protect)) {
            accuracy = 50;
        }
        
        //System.err.println ("Tem status? " + battlePokemon.haveBattleStatus(BattleStatusEnum.protect) + "\nAccuracy: "+accuracy); 
        if (Util.probability(accuracy)) {
            battlePokemon.setBattleStatus(BattleStatusEnum.protect);
            Util.printAndWait(battlePokemon + " protect itself!");
        } else {
            battlePokemon.removeBattleStatus(BattleStatusEnum.protect);
            Util.printAndWait("But, it failed!");
        }
    }
}
